home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 30 April 1998
- //
- // Author: mgr
- //
- // Description:
- // A function to hide/show the selected CVs on a nurbs surface.
- //
-
-
- global proc selectiveCvsDisplay( int $hide )
- //
- // $hide == 1 : hide the cvs that are not selected on the surface by turning
- // on the selective cv display attribute for the surface.
- //
- // $hide == 0 : show all the cvs on the selected surface by turning off the
- // selective cv display attribute for the surface.
- //
- {
- // get the list of objects selected with CV components.
- //
- global int $gSelectCVsBit;
- string $surfaceList[] = `filterExpand -ex false -sm $gSelectCVsBit`;
- int $numSurfaces = size($surfaceList);
- if ( $numSurfaces == 0 )
- {
- warning("No CVs on a NURBS surface selected.");
- return;
- }
-
- // from the items with CVs selected, get the name of the object only
- // (ignoring the component) - this will also filter the list to
- // ignore duplicate items
- //
- $surfaceList = `ls -sl -o $surfaceList`;
-
- // now select the objects that had CVs selected and filter that list
- // for nurbs surfaces only
- //
- global int $gSelectNurbsSurfacesBit;
- $surfaceList = `filterExpand -ex false -sm $gSelectNurbsSurfacesBit $surfaceList`;
- $numSurfaces = size($surfaceList);
- if ( $numSurfaces == 0 )
- {
- warning("No CVs on a NURBS surface selected.");
- return;
- }
-
- // turn on/off the selective CV display for the nurbs surfaces
- //
- int $i;
- int $isAlreadySelective;
- for ( $i = 0; $i < $numSurfaces; $i++ )
- {
- // if setting the attribute on the surface to true/false but the
- // attribute is already true/false, then no need to do a setAttr again
- //
- $isAlreadySelective = eval("getAttr " + $surfaceList[$i] + ".scvd");
- if ( $hide == $isAlreadySelective )
- {
- if ( $hide == 1 )
- warning("Selective CV display is already on for this surface.");
- else
- warning("Selective CV display is already off for this surface.");
-
- continue;
- }
-
- eval("setAttr " + $surfaceList[$i] + ".scvd " + $hide);
- }
- }
-